package wh.重复元素1;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: wh(1835734390 @ qq.com)
 * @date: 2022/12/30 21:58
 * @description:
 * @version:
 */
public class Solution {
    public static void main(String[] args) {
        int[] arr = {1,1,1,3,3,4,3,2,4,2};
        boolean b = containsDuplicate(arr);
        System.out.println(b);
    }

    public static boolean containsDuplicate(int[] nums) {
        Map<Integer,Integer> map = new HashMap<>();
        for (Integer num : nums){
            map.put(num,map.getOrDefault(num,0) + 1);
            if (map.get(num) > 1){
                return true;
            }
        }
        return false;
    }
}
